﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;


namespace BaiTu.Web.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return RedirectToAction("add");
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }


        public ActionResult Add(DTOS.UserDTO userDTO)
        {
            if (userDTO == null)
            {
                userDTO = new DTOS.UserDTO()
                {
                    Age = 11,
                    Description = "郭志奇 正在进行一个大的项目开发",
                    Name = "郭志奇"
                };
            }
            IBLL.IUserBLL userBLL = new BLL.UserBLL();
            var result = userBLL.Add(userDTO);
            return Json(result.Success + "  " + result.ErrorMessage, JsonRequestBehavior.AllowGet);
        }
    }
}
